package com.video.controller;

import com.video.result.ResultVO;
import com.video.service.TagsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author baoshuai
 * @date 2022/12/16
 */
@Api(tags = "标签模块接口")
@RestController
@RequestMapping("/tag")
public class TagController {

    @Resource
    private TagsService tagsService;

    @ApiOperation("获取今日标签浏览量排行")
    @GetMapping("/hotTagsTop50")
    public ResultVO hotTagsTop50() {
        return tagsService.hotTags();
    }

    @ApiOperation("根据标签分页查找对应的视频")
    @GetMapping("/pageVlogs/{tagId}/{pageNum}/{pageSize}")
    public ResultVO pageVlogs(@PathVariable Long tagId,
                              @PathVariable Integer pageNum,
                              @PathVariable Integer pageSize) {
        return tagsService.pageVlogsByTagId(tagId, pageNum, pageSize);
    }

    @ApiOperation("查找标签总览量top6")
    @GetMapping("/selectTagsTop6")
    public ResultVO selectTagsTop6() {
        return tagsService.selectTagsTop6();
    }

    @ApiOperation("模糊查找标签")
    @GetMapping("/getTagsByKeyword")
    public ResultVO getTagsByKeyword(String keyword) {
        return tagsService.getTagsByKeyword(keyword);
    }
}
